replace last two characters string php

35

$start_time = '1030';
$pattern    = '/(?<=\d\d)30/';
$start_time = preg_replace($pattern, '50', $start_time);

//result: 1050

Comments

Submit
0 Comments